
package com.google.code.lebar.bean.response.hotspot;


import java.util.ArrayList;
import java.util.List;

import com.google.code.lebar.bean.response.action.Action;
import com.google.code.lebar.bean.response.animation.Animation;
import com.google.code.lebar.bean.response.animation.FullAnimation;
import com.google.code.lebar.bean.response.animation.SimpleAnimation;
import com.google.code.lebar.bean.response.hotspot.transform.Transform;


public class Hotspot implements Cloneable
{
    private String id;
    private Anchor anchor;
    private Text text;
    private List<Action> actions;
    private String imageURL;
    private Boolean showSmallBiw;
    private Boolean showBiwOnClick;
    private String biwStyle;
    private Icon icon;
    private HotspotObject object;
    private Transform transform;
    private Animation animations;
    private Boolean inFocus;

    public Hotspot clone()
    {
        Hotspot tClonedHotspot = new Hotspot();
        tClonedHotspot.setId( getId() );
        tClonedHotspot.setAnchor( getAnchor().clone() );
        tClonedHotspot.setText( getText().clone() );
        tClonedHotspot.setActions( cloneActions() );
        tClonedHotspot.setImageURL( getImageURL() );
        tClonedHotspot.setShowSmallBiw( getShowSmallBiw() );
        tClonedHotspot.setShowBiwOnClick( getShowBiwOnClick() );
        tClonedHotspot.setBiwStyle( getBiwStyle() );
        tClonedHotspot.setIcon( getIcon() );
        tClonedHotspot.setObject( getObject().clone() );
        tClonedHotspot.setTransform( getTransform().clone() );
        tClonedHotspot.setAnimations( cloneAnimation() );
        tClonedHotspot.setInFocus( getInFocus() );

        return tClonedHotspot;
    }

    private Animation cloneAnimation()
    {
        if ( getAnimations() instanceof SimpleAnimation )
        {
            return getAnimations();
        }
        else if ( getAnimations() instanceof FullAnimation )
        {
            return (Animation) ( (FullAnimation) getAnimations() ).clone();
        }

        return null;
    }

    private List<Action> cloneActions()
    {
        if ( getActions() == null ) return null;

        List<Action> tClonedActions = new ArrayList<Action>();
        for ( Action tAction : getActions() )
        {
            tClonedActions.add( tAction.clone() );
        }

        return tClonedActions;
    }

    /**
     * @return the id
     */
    public String getId()
    {
        return id;
    }

    /**
     * @return the anchor
     */
    public Anchor getAnchor()
    {
        return anchor;
    }

    /**
     * @return the text
     */
    public Text getText()
    {
        return text;
    }

    /**
     * @return the actions
     */
    public List<Action> getActions()
    {
        return actions;
    }

    /**
     * @return the imageURL
     */
    public String getImageURL()
    {
        return imageURL;
    }

    /**
     * @return the showSmallBiw
     */
    public Boolean getShowSmallBiw()
    {
        return showSmallBiw;
    }

    /**
     * @return the showBiwOnClick
     */
    public Boolean getShowBiwOnClick()
    {
        return showBiwOnClick;
    }

    /**
     * @return the biwStyle
     */
    public String getBiwStyle()
    {
        return biwStyle;
    }

    /**
     * @return the icon
     */
    public Icon getIcon()
    {
        return icon;
    }

    /**
     * @return the object
     */
    public HotspotObject getObject()
    {
        return object;
    }

    /**
     * @return the transform
     */
    public Transform getTransform()
    {
        return transform;
    }

    /**
     * @return the animations
     */
    public Animation getAnimations()
    {
        return animations;
    }

    /**
     * @return the inFocus
     */
    public Boolean getInFocus()
    {
        return inFocus;
    }

    /**
     * @param id
     *            the id to set
     */
    public void setId( String id )
    {
        this.id = id;
    }

    /**
     * @param anchor
     *            the anchor to set
     */
    public void setAnchor( Anchor anchor )
    {
        this.anchor = anchor;
    }

    /**
     * @param text
     *            the text to set
     */
    public void setText( Text text )
    {
        this.text = text;
    }

    /**
     * @param actions
     *            the actions to set
     */
    public void setActions( List<Action> actions )
    {
        this.actions = actions;
    }

    /**
     * @param imageURL
     *            the imageURL to set
     */
    public void setImageURL( String imageURL )
    {
        this.imageURL = imageURL;
    }

    /**
     * @param showSmallBiw
     *            the showSmallBiw to set
     */
    public void setShowSmallBiw( Boolean showSmallBiw )
    {
        this.showSmallBiw = showSmallBiw;
    }

    /**
     * @param showBiwOnClick
     *            the showBiwOnClick to set
     */
    public void setShowBiwOnClick( Boolean showBiwOnClick )
    {
        this.showBiwOnClick = showBiwOnClick;
    }

    /**
     * @param biwStyle
     *            the biwStyle to set
     */
    public void setBiwStyle( String biwStyle )
    {
        this.biwStyle = biwStyle;
    }

    /**
     * @param icon
     *            the icon to set
     */
    public void setIcon( Icon icon )
    {
        this.icon = icon;
    }

    /**
     * @param object
     *            the object to set
     */
    public void setObject( HotspotObject object )
    {
        this.object = object;
    }

    /**
     * @param transform
     *            the transform to set
     */
    public void setTransform( Transform transform )
    {
        this.transform = transform;
    }

    /**
     * @param animations
     *            the animations to set
     */
    public void setAnimations( Animation animations )
    {
        this.animations = animations;
    }

    /**
     * @param inFocus
     *            the inFocus to set
     */
    public void setInFocus( Boolean inFocus )
    {
        this.inFocus = inFocus;
    }
}
